import { dateFormat } from '@/util/date';
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
let now = new Date();
now.setDate(now.getDate() + 1);
export const endDate = dateFormat(now, 'yyyy-MM-dd');
export const tableOption = {
  border: true,
  index: true,
  indexLabel: "序号",
  stripe: true,
  menuAlign: "center",
  align: "center",
  dialogWidth: "70%",
  printBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  viewBtn: true,
  searchSize: "mini",
  labelWidth: 130,
  searchMenuSpan: 6,
  column: [
    {
      label: "标识",
      prop: "id",
      hide: true,
      display: false
    },
    {
      label: "入库单号",
      prop: "instockno",
      search: true,
      display: false
    },
    {
      label: "入库类型",
      prop: "inGoingType",
      search: true,
      type: "select",
      dicUrl: "/admin/dict/type/inventory_in_type",
      display: false
    },
    {
      label: "入库时间",
      prop: "inGoingTime",
      type: "datetime",
      search: true,
      searchRange: true,
      searchSpan: 12,
      format: "yyyy-MM-dd",
      valueFormat: "yyyy-MM-dd",
      searchValue: [startDate, endDate],
      display: false
    },
    {
      label: "票种",
      prop: "ticketType",
      search: true,
      type: "select",
      dicUrl: "/support/swpmticketcardtype/dict",
      props: {
        label: "mainName",
        value: "mainEnName"
      },
      cascaderItem: ["ticketName"],
      display: false
    },
    {
      label: "车票名称",
      prop: "ticketName",
      search: true,
      type: "select",
      props: {
        label: "subName",
        value: "subEnName"
      },
      dicUrl: "/support/swpmticketcardtypeparam/dictAll/{{key}}",
      dicFlag: false,
      display: false
    },
    {
      "label": "车票种类",
      "prop": "ticketReturnType",
      type: 'select',
      dicUrl: '/admin/dict/type/TICKET_RETURN_TYPE',
      filterable: true,
      allowCreate: false,
      search: true,
      width: 110,
      display: false
    },
    {
      label: '审批状态',
      prop: 'checkApproveStatus',
      type: 'select',
      search: true,
      dicUrl: '/admin/dict/type/check_approve_status',
      display: false
    },
    {
      label: "车票次数",
      prop: "ticketTimes",
      display: false
    },
    {
      label: "车票金额",
      prop: "ticketPrice",
      type: "number",
      precision: 2,
      display: false
    },
    {
      label: "车票数量",
      prop: "ticketNumber",
      type: "number",
      precision: 0,
      display: false
    },
    {
      label: "库区分区",
      prop: "stockArea",
      type: "select",
      search: true,
      dicUrl: "/support/swpmticketarea/dictCustom",
      props: {
        label: "ticketAreaName",
        value: "id"
      },
      display: false
    },
    {
      label: "车票有效期",
      prop: "activeTime",
      type: "input",
      //precision: 0,
      display: false
    },
    {
      label: "有效期单位",
      prop: "activeUnit",
      type: "input",
      hide: true,
      display: false
    },
    {
      label: "车票最晚使用时间",
      prop: "latestStartTime",
      type: "date",
      format: "yyyy-MM-dd",
      valueFormat: "yyyy-MM-dd HH:mm:ss",
      display: false
    },
    {
      label: "库管1",
      prop: "keeper1name",
      type: "select",
      component: "user-select",
      params: {
        userCodeKey: "keeper1code"
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      search: true,
      display: false
    },
    {
      label: "库管1工号",
      prop: "keeper1code",
      display: false
    },
    {
      label: "库管2",
      prop: "keeper2name",
      type: "select",
      component: "user-select",
      params: {
        userCodeKey: "keeper2code"
      },
      dicFlag: false,
      dicQuery: {
        belongToLine: true
      },
      search: true,
      display: false
    },
    {
      label: "库管2工号",
      prop: "keeper2code",
      display: false
    },
    {
      label: "起号/止号",
      prop: "ticketNo",
      type: "textarea",
      display: false
    },
    {
      label: "分解状态",
      prop: "breakFlag",
      dicData: [
        {
          label: "未分解",
          value: "0"
        },
        {
          label: "已分解",
          value: "1"
        }
      ],
      display: false
    },
    {
      label: "数据来源",
      prop: "dataSource",
      type: "select",
      search: true,
      dicUrl: "/admin/dict/type/dataSource_status",
      display: false
    },
    {
      label: "备注",
      prop: "remark",
      type: "textarea",
      hide: true,
      display: false
    },
    {
      label: "创建人ID",
      prop: "creatorId",
      hide: true,
      display: false
    },
    {
      label: "创建人名称",
      prop: "creatorName",
      hide: true,
      display: false
    },
    {
      label: "创建时间",
      prop: "createtime",
      hide: true,
      display: false
    }
  ],
  group: [
    {
      label: "入库信息摘要",
      column: [
        {
          label: "入库单号",
          prop: "instockno",
          addDisplay: false,
          disabled: true
        },
        {
          label: "入库人工号",
          prop: "keepercode",
          type: "select",
          component: "user-select",
          params: {
            prop: "keepercode",
            userCodeKey: "keepername",
            labelKey: "userCode",
            valueKey: "nikename",
            allowCreate: true
          },
          dicQuery: {
            belongToLine: true
          },
          // rules: [
          //   {
          //     required: true,
          //     message: "请选择入库人工号",
          //     trigger: "blur"
          //   }
          // ]
        },
        {
          label: "入库人",
          prop: "keepername",
          //disabled: true,
          //placeholder: " "
          rules: [{
            required: true,
            message: '请输入入库人',
            trigger: 'blur'
          }]
        },
        {
          label: "入库类型",
          prop: "inGoingType",
          type: "select",
          dicUrl: "/admin/dict/type/inventory_in_type",
          //editDisabled: true,
          rules: [
            {
              required: true,
              message: "请选择入库类型",
              trigger: "blur"
            }
          ]
        },
        {
          label: "入库时间",
          prop: "inGoingTime",
          type: "datetime",
          format: "yyyy-MM-dd HH:mm:ss",
          valueFormat: "yyyy-MM-dd HH:mm:ss",
          rules: [
            {
              required: true,
              message: "请输入入库时间",
              trigger: "blur"
            }
          ]
        }
      ]
    },
    {
      label: "入库明细",
      column: [
        {
          label: "票种",
          prop: "ticketType",
          type: "select",
          dicUrl: "/support/swpmticketcardtype/dict",
          props: {
            label: "mainName",
            value: "mainEnName"
          },
          cascaderItem: ["ticketName"],
          //editDisabled: true,
          rules: [
            {
              required: true,
              message: "请选择车票种类",
              trigger: "blur"
            }
          ]
        },
        {
          label: "车票名称",
          prop: "ticketName",
          type: "select",
          props: {
            label: "subName",
            value: "subEnName"
          },
          dicUrl: "/support/swpmticketcardtypeparam/dictAll/{{key}}",
          dicFlag: false,
          //editDisabled: true,
          rules: [
            {
              required: true,
              message: "请选择车票名称",
              trigger: "blur"
            }
          ],
          component: "ticket-name-select",
          params: {
            ticketAmountKey: "ticketPrice",
            ticketCountKey: "ticketTimes"
          }
        },
        {
          "label": "车票种类",
          "prop": "ticketReturnType",
          type: 'select',
          dicUrl: '/admin/dict/type/TICKET_RETURN_TYPE',
          dicFlag: true,
          filterable: true,
          allowCreate: false,
          width: 110
        },
        {
          label: "车票次数",
          prop: "ticketTimes",
          type: "number",
          addDisabled: true,
          placeholder: " "
        },
        {
          label: "车票金额",
          prop: "ticketPrice",
          type: "number",
          precision: 2,
          addDisabled: true,
          placeholder: " "
        },
        {
          label: "车票数量",
          prop: "ticketNumber",
          type: "number",
          precision: 0,
          //editDisabled: true,
          rules: [
            {
              required: true,
              message: "请输入车票数量",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库区分区",
          prop: "stockArea",
          type: "select",
          dicUrl: "/support/swpmticketarea/dict",
          props: {
            label: "ticketAreaName",
            value: "id"
          },
          //editDisabled: true,
          rules: [
            {
              required: true,
              message: "请选择库区分区",
              trigger: "blur"
            }
          ]
        },
        {
          label: "车票有效期",
          prop: "activeTime",
          type: "input",
          //precision: 0,
          //editDisabled: true,
          // rules: [
          //   {
          //     required: true,
          //     message: "请输入车票有效期",
          //     trigger: "blur"
          //   }
          // ]
        },
        {
          label: "有效期单位",
          prop: "activeUnit",
          type: "input",
          hide: true,
          display: false
          //editDisabled: true,
        },
        {
          label: "车票最晚使用时间",
          prop: "latestStartTime",
          type: "date",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd HH:mm:ss",
          //editDisabled: true,
          // rules: [
          //   {
          //     message: "请输入车票最晚使用时间",
          //     trigger: "blur"
          //   }
          // ]
        },
        {
          label: "库管2",
          prop: "keeper2name",
          type: "select",
          component: "user-select",
          params: {
            userCodeKey: "keeper2code"
          },
          dicFlag: false,
          dicQuery: {
            belongToLine: true
          },
          rules: [
            {
              required: true,
              message: "请选择库管2",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管2工号",
          prop: "keeper2code",
          disabled: true,
          placeholder: " "
        },
        {
          label: "起号/止号",
          prop: "ticketNo",
          type: "textarea",
          maxRows: 6,
          minRows: 4,
          //editDisabled: true,
          span: 24
        },
        {
          label: "上传附件",
          prop: "filePath",
          type: "upload",
          component: "zd-upload",
          dataType: "string",
          cell: true,
          span: 24
        },
        {
          label: "上传图片",
          prop: "picturePath",
          type: "upload",
          component: "zd-upload",
          listType: "picture-img",
          span: 24
        },
        {
          label: "备注",
          prop: "remark",
          type: "textarea",
          maxRows: 6,
          minRows: 4,
          span: 24
        }
      ]
    }
  ]
};


export const tableOptionAdd = {
  border: true,
  index: true,
  indexLabel: "序号",
  align: "center",
  labelWidth: 130,
  submitBtn:false,
  emptyBtn:false,
  group: [
    {
      label: "入库信息摘要",
      column: [
        {
          label: "入库单号",
          prop: "instockno",
          addDisplay: false,
          disabled: true
        },
        {
          label: "入库类型",
          prop: "inGoingType",
          type: "select",
          dicUrl: "/admin/dict/type/inventory_in_type",
          rules: [
            {
              required: true,
              message: "请选择入库类型",
              trigger: "blur"
            }
          ]
        },
        {
          label: "入库时间",
          prop: "inGoingTime",
          type: "datetime",
          format: "yyyy-MM-dd HH:mm:ss",
          valueFormat: "yyyy-MM-dd HH:mm:ss",
          rules: [
            {
              required: true,
              message: "请输入入库时间",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管2",
          prop: "keeper2name",
          type: "select",
          component: "user-select",
          params: {
            userCodeKey: "keeper2code"
          },
          dicFlag: false,
          dicQuery: {
            belongToLine: true
          },
          rules: [
            {
              required: true,
              message: "请选择库管2",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管2工号",
          prop: "keeper2code",
          disabled: true,
          placeholder: " "
        },
        {
          label: "上传图片",
          prop: "picturePath",
          type: "upload",
          component: "zd-upload",
          listType: "picture-img",
          //span: 24
        },
      ]
    }
  ]
};

export const tableOptionAddDetail = {
  border: true,
  index: true,
  indexLabel: "序号",
  align: "center",
  labelWidth: 130,
  column: [
    {
      label: "票种",
      prop: "ticketType",
      type: "select",
      dicUrl: "/support/swpmticketcardtype/dict",
      props: {
        label: "mainName",
        value: "mainEnName"
      },
      cascaderItem: ["ticketName"],
      cell: true,
      width: 150,
      rules: [
        {
          required: true,
          message: "请选择车票种类",
          trigger: "blur"
        }
      ]
    },
    {
      label: "车票名称",
      prop: "ticketName",
      type: "select",
      props: {
        label: "subName",
        value: "subEnName"
      },
      dicUrl: "/support/swpmticketcardtypeparam/dictAll/{{key}}",
      dicFlag: false,
      rules: [
        {
          required: true,
          message: "请选择车票名称",
          trigger: "blur"
        }
      ],
      component: "ticket-name-select",
      params: {
        ticketAmountKey: "ticketPrice",
        ticketCountKey: "ticketTimes"
      },
      width: 180
    },
    {
      label: "车票次数",
      prop: "ticketTimes",
      type: "number",
      addDisabled: true,
      placeholder: " ",
      width: 130,
      cell: true
    },
    {
      label: "车票金额",
      prop: "ticketPrice",
      type: "number",
      precision: 2,
      addDisabled: true,
      placeholder: " ",
      width: 130,
      cell: true
    },
    {
      label: "车票数量",
      prop: "ticketNumber",
      type: "number",
      precision: 0,
      cell: true,
      width: 130,
      rules: [
        {
          required: true,
          message: "请输入车票数量",
          trigger: "blur"
        }
      ]
    },
    {
      label: "库区分区",
      prop: "stockArea",
      type: "select",
      dicUrl: "/support/swpmticketarea/dict",
      props: {
        label: "ticketAreaName",
        value: "id"
      },
      width: 160,
      cell: true,
      rules: [
        {
          required: true,
          message: "请选择库区分区",
          trigger: "blur"
        }
      ]
    },
    {
      label: "车票有效期",
      prop: "activeTime",
      type: "input",
      //precision: 0,
      width: 160,
      cell: true
    },
    {
      label: "有效期单位",
      prop: "activeUnit",
      type: "input",
      width: 120,
      cell: true,
      hide: true,
      display: false
    },
    {
      label: "车票最晚使用时间",
      prop: "latestStartTime",
      type: "date",
      format: "yyyy-MM-dd",
      valueFormat: "yyyy-MM-dd HH:mm:ss",
      cell: true,
      width: 180,
      // rules: [
      //   {
      //     message: "请输入车票最晚使用时间",
      //     trigger: "blur"
      //   }
      // ]
    },
    {
      label: "起号/止号",
      prop: "ticketNo",
      type: "input",
      width: 180,
      cell: true
    },{
      label: "入库人工号",
      prop: "keepercode",
      type: "select",
      component: "user-select",
      params: {
        prop: "keepercode",
        userCodeKey: "keepername",
        labelKey: "userCode",
        valueKey: "nikename",
        allowCreate: true
      },
      dicQuery: {
        belongToLine: true
      },
      width: 160
    },
    {
      label: "入库人",
      prop: "keepername",
      type: "input",
      cell: true,
      rules: [{
        required: true,
        message: '请输入入库人',
        trigger: 'blur'
      }],
      width: 150
    },
    {
      label: "上传附件",
      prop: "filePath",
      type: "upload",
      component: "zd-upload",
      dataType: "string",
      width: 420,
      cell: true
    },
    {
      label: "备注",
      prop: "remark",
      type: "input",
      width: 200,
      cell: true
    }
  ]
};

export const recycleTableOptionComplete = {
  border: true,
  index: true,
  indexLabel: "序号",
  stripe: true,
  menuAlign: "center",
  align: "center",
  dialogWidth: "70%",
  printBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  viewBtn: true,
  searchSize: "mini",
  labelWidth: 130,
  submitBtn: false,
  emptyBtn: false,
  group: [
    {
      label: "入库明细",
      column: [
        {
          label: "库区分区",
          prop: "stockArea",
          type: "select",
          dicUrl: "/support/swpmticketarea/dict",
          props: {
            label: "ticketAreaName",
            value: "id"
          },
          // disabled: true
        },
        {
          label: "车票最晚使用时间",
          prop: "latestStartTime",
          type: "date",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd HH:mm:ss",
          // rules: [
          //   {
          //     message: "请输入车票最晚使用时间",
          //     trigger: "blur"
          //   }
          // ]
        },
        {
          label: "库管2",
          prop: "keeper2name",
          type: "select",
          component: "user-select",
          params: {
            userCodeKey: "keeper2code"
          },
          dicFlag: false,
          dicQuery: {
            belongToLine: true
          },
          rules: [
            {
              required: true,
              message: "请选择库管2",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管2工号",
          prop: "keeper2code",
          disabled: true,
          placeholder: " "
        }
      ]
    }
  ]
};

export const tableOptionComplete = {
  border: true,
  index: true,
  indexLabel: "序号",
  stripe: true,
  menuAlign: "center",
  align: "center",
  dialogWidth: "70%",
  printBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  viewBtn: true,
  searchSize: "mini",
  labelWidth: 130,
  submitBtn: false,
  emptyBtn: false,
  group: [
    {
      label: "入库明细",
      column: [
        {
          label: "库区分区",
          prop: "stockArea",
          type: "select",
          dicUrl: "/support/swpmticketarea/dict",
          props: {
            label: "ticketAreaName",
            value: "id"
          },
          disabled: false,
          rules: [
            {
              required: true,
              message: "请选择库区分区",
              trigger: "blur"
            }
          ]
        },
        {
          label: "车票最晚使用时间",
          prop: "latestStartTime",
          type: "date",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd HH:mm:ss",
          // rules: [
          //   {
          //     message: "请输入车票最晚使用时间",
          //     trigger: "blur"
          //   }
          // ]
        },
        {
          label: "库管1",
          prop: "keeper1name",
          type: "select",
          component: "user-select",
          params: {
            userCodeKey: "keeper1code"
          },
          dicFlag: false,
          dicQuery: {
            belongToLine: true
          },
          rules: [
            {
              required: true,
              message: "请选择库管1",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管1工号",
          prop: "keeper1code",
          disabled: true,
          placeholder: " "
        },
        {
          label: "库管2",
          prop: "keeper2name",
          type: "select",
          component: "user-select",
          params: {
            userCodeKey: "keeper2code"
          },
          dicFlag: false,
          dicQuery: {
            belongToLine: true
          },
          rules: [
            {
              required: true,
              message: "请选择库管2",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管2工号",
          prop: "keeper2code",
          disabled: true,
          placeholder: " "
        },
        {
          label: "起号/止号",
          prop: "ticketNo",
          type: "textarea",
          maxRows: 6,
          minRows: 4,
          span: 24
        }
      ]
    }
  ]
};

export const tableOptionBatchComplete = {
  border: true,
  index: true,
  indexLabel: "序号",
  stripe: true,
  menuAlign: "center",
  align: "center",
  dialogWidth: "70%",
  printBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  viewBtn: true,
  searchSize: "mini",
  labelWidth: 140,
  submitBtn: false,
  emptyBtn: false,
  group: [
    {
      label: "入库明细",
      column: [
        {
          label: "库区分区",
          prop: "stockArea",
          type: "select",
          dicUrl: "/support/swpmticketarea/dict",
          props: {
            label: "ticketAreaName",
            value: "id"
          },
          rules: [
            {
              required: true,
              message: "请选择库区分区",
              trigger: "blur"
            }
          ]
        },
        {
          label: "车票最晚使用时间",
          prop: "latestStartTime",
          type: "date",
          format: "yyyy-MM-dd",
          valueFormat: "yyyy-MM-dd HH:mm:ss"
        },
        {
          label: "库管2",
          prop: "keeper2name",
          type: "select",
          component: "user-select",
          params: {
            userCodeKey: "keeper2code"
          },
          dicFlag: false,
          dicQuery: {
            belongToLine: true
          },
          rules: [
            {
              required: true,
              message: "请选择库管2",
              trigger: "blur"
            }
          ]
        },
        {
          label: "库管2工号",
          prop: "keeper2code",
          disabled: true,
          placeholder: " "
        }
      ]
    }
  ]
};
